package com.lz.ui_lib.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lz.ui_lib.R;
import com.lz.ui_lib.bean.ActivityInfos;

/**
 * Demo功能Adapter
 * <p>
 * Created by Liuyk on 2017/10/19.
 */
public class PagerAdapter extends AppBaseAdapter<ActivityInfos> {

    public PagerAdapter(Context context) {
        super(context);
    }

    @Override
    protected View getResources(int position, ViewGroup parent) {
        return inflateView(parent, R.layout.ui_drag_item_layout);
    }

    @Override
    protected View appGetView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = (ViewHolder) convertView.getTag();
        if (holder == null) {
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        }
        ActivityInfos data = getData(position);
        holder.demoFunctionName.setText(data.getName());
        return convertView;
    }

    static class ViewHolder {
        TextView demoFunctionName;

        ViewHolder(View view) {
            demoFunctionName = view.findViewById(R.id.ui_demo_name);
        }
    }
}
